gh-148865: Add support for viscii encoding in codecs#148866
gh-148865: Add support for viscii encoding in codecs#148866henryivesjones wants to merge 2 commits intopython:mainfrom
Conversation
The codecs module does not support the viscii encoding. This change adds support.
|
RFC 1456 was written many years ago, and as such even has a warning:
Is this encoding this used anywhere, is there a need for it to be added (compared to a third party package)? |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
If we accept this codec (this is still discussed), it needs also an entry in What's New.
| @@ -0,0 +1,264 @@ | |||
| # Name: VISCII (RFC1456) to Unicode | |||
| # Date: 2026-04-22 | |||
| # Authors: Henry Jones <2020henryijones@gmail.com> | |||
There was a problem hiding this comment.
This is not an official document. No need to include this file, it has the same authority as viscii.py.
There was a problem hiding this comment.
There are several "official" mapping documents that I would be happy to use as a source of authority.
https://vietstd.sourceforge.net/report/rep92.htm#page30
I had simply adapted the official documents into the format that gencodec.py ingests. I would be happy to include the "official" source and write an implementation of gencodec.py that can generate the python encoding file.
| @@ -0,0 +1,2 @@ | |||
| ``codecs`` does not support the viscii charset. It now supports the viscii | |||
There was a problem hiding this comment.
This is self-contradictory.
| @@ -0,0 +1,311 @@ | |||
| """Python Character Mapping Codec viscii generated from 'python-mappings/VISCII.TXT' with gencodec.py.""" # " | |||
There was a problem hiding this comment.
Remove reference to python-mappings/VISCII.TXT, it is not an independent source.
There was a problem hiding this comment.
(This was generated by the script)
There was a problem hiding this comment.
Yes, but this is an implementation detail. The source is not an independent source, we could create viscii.py directly.
|
@malemburg do you know if this was rejected previously? WDYT? I think this legacy encoding can be left to third party packages, I searched the internet but was unable to find any modern use. @henryivesjones, do you have an actual use case for this encoding? |
|
@StanFromIreland I came across it in an email sent in 2026. I will also point out that According to this recent issue all of the list of charsets in the email lib have support in the stdlib EXCEPT for viscii. Is there some type of decision making framework on what encodings get included? |
The codecs module does not support the viscii encoding. This change adds support.
The mapping was generated from and checked against the viscii rfc1456.
The vietstd was the author of that rfc and has also published this table which was also used as reference.
https://vietstd.sourceforge.net/document/unicode.html
VISCIIencoding incodecs#148865